module V {
	/**
	 * 大厅界面
	 * @author hong
	 */
    export class MainScene extends eui.Component {
        /** 用户昵称 */
        private userName:eui.Label;
        /** 用户游戏币 */
        private userCoin:eui.Label;
        /** 房间列表 */
        private kindList:eui.List;

         public constructor() {
             super();
             this.skinName = "MainSceneSkin";
         }

         public childrenCreated(): void {
             this.userCoin.text = D.App.userData.gameScore.toString();
             this.userName.text = D.App.userData.nickName;
             this.kindList.dataProvider = new eui.ArrayCollection(D.App.roomList.filter(r=>r.serverID==5899));
             this.kindList.addEventListener(egret.TouchEvent.TOUCH_TAP, this.clickItem, this);
         }

         /** 点击了元素 */
         public clickItem(e:egret.TouchEvent):void{
             console.log(e.currentTarget.selectedItem);
             e.currentTarget.selectedItem && D.RoomData.enter(e.currentTarget.selectedItem);
         }
    }
}